import request from '@/config/axios'

// 农场违规记录 VO
export interface ViolationRecordVO {
  id?: number // 主键ID
  farmId: number // 农场ID
  farmNo: string // 农场编号
  farmName: string // 农场名称
  violationTime: Date | string // 违规时间
  violationReason: string // 违规原因
  violationDetail?: string // 违规详情（详细描述）
  evidenceFiles?: string // 证据文件
  remark?: string // 备注
}

// 农场违规记录 API
export const ViolationRecordApi = {
  // 查询农场违规记录分页
  getViolationRecordPage: async (params: any) => {
    return await request.get({ url: `/system/farm/violation-record/page`, params })
  },

  // 查询农场违规记录详情
  getViolationRecord: async (id: number) => {
    return await request.get({ url: `/system/farm/violation-record/get?id=` + id })
  },

  // 根据农场ID获取违规记录列表
  getViolationRecordListByFarmId: async (farmId: number) => {
    return await request.get({ url: `/system/farm/violation-record/list-by-farm-id`, params: { farmId } })
  },

  // 新增农场违规记录
  createViolationRecord: async (data: ViolationRecordVO) => {
    return await request.post({ url: `/system/farm/violation-record/create`, data })
  },

  // 修改农场违规记录
  updateViolationRecord: async (data: ViolationRecordVO) => {
    return await request.put({ url: `/system/farm/violation-record/update`, data })
  },

  // 删除农场违规记录
  deleteViolationRecord: async (id: number) => {
    return await request.delete({ url: `/system/farm/violation-record/delete?id=` + id })
  },

  // 批量删除农场违规记录
  deleteViolationRecordList: async (ids: number[]) => {
    return await request.delete({ url: `/system/farm/violation-record/delete-batch`, data: ids })
  },

  // 导出农场违规记录 Excel
  exportViolationRecord: async (params) => {
    return await request.download({ url: `/system/farm/violation-record/export-excel`, params })
  }
}
